
{include file="public/meta" /}


</head>

<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>邮件配置</h5>
                    <div class="ibox-tools">
                        <a class="link">
                            <b>
                                <i class="layui-icon layui-icon-refresh"></i>
                            </b>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <table id="demo" class="layui-hide" lay-filter="test"></table>
                    <script type="text/html" id="opeBar">
                        <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use('table', function(){
        var table = layui.table
            , form = layui.form;
        //第一个实例
        table.render({
            elem: '#demo'
            //,height: 312
            ,url: "{:url('admin/email/index')}" //数据接口
            ,page: false //开启分页
            ,response: {
                statusCode: 200 //成功的状态码，默认：0
            }
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , toolbar: '#toolbarDemo'
            , defaultToolbar: ['filter','exports'] //工具类
            , loading: true
            , id: 'test'
            ,cols: [[ //表头
                {field: 'name', title: '参数'}
                ,{field: 'value', title: '值'}
                ,{field: 'notice', title: '备注'}
                ,{fixed: 'right', width:150, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
        });
        //监听搜索
        form.on('submit(LAY-search)', function (data) {
            //执行重载
            table.reload('test', {
                page: {
                    curr: 1 //重新从第 1 页开始
                }
                ,where: data.field
            });
        });
        //监听工具条
        table.on('tool(test)', function(obj){
            if(obj.event === 'edit'){
                layer.open({
                    type: 2,
                    shade: false,
                    area: ['650px','650px'],
                    maxmin: true,
                    content: "http://localhost/phpmailer/public/mail_setting_edit.html?id="+obj.data.id,
                    zIndex: layer.zIndex, //重点1
                    success: function(layero){
                        layer.setTop(layero); //重点2
                    }
                });
            }
        });
    });
</script>
<!-- 全局js -->
{include file="public/footer" /}
</body>

</html>
